package com.example.snap_it;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.View;

public class RegrasActivity extends ActivityComMusicaFundo {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_regras);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.regras, menu);
		return true;
	}
	
	public void jogarUmJogador(View botaoJogar)
	{
		Intent iniciaActivityJogo = new Intent(RegrasActivity.this, EscolhaListaDeDicas.class);
		startActivity(iniciaActivityJogo);
		
	}
	
	public void mudarConfiguracoes(View botaoConfiguracoes)
	{
		Intent iniciaActivityConfigUmJogador = new Intent(RegrasActivity.this, ConfiguracoesUmJogadorActivity.class);
		startActivityForResult(iniciaActivityConfigUmJogador, 1);
	}
	
	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data)
	{
		if(resultCode == RESULT_OK)
		{
			String configLimiteTempo = data.getStringExtra("novaConfigTempoLimite");
			int inteiroConfigLimiteDeTempo = Integer.valueOf(configLimiteTempo);
			SharedPreferences configuracoesSalvar = getSharedPreferences("configuracoes_um_jogador", Context.MODE_PRIVATE);
			SharedPreferences.Editor editorConfig = configuracoesSalvar.edit();
			editorConfig.putInt("limite_tempo_um_jogador", inteiroConfigLimiteDeTempo);
			editorConfig.commit();
			
		}
		
		
	}

}
